package joaomarceloos.paintapp;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class CreateParticipantActivity extends Activity {

	private String nomeParticipante = "Pedrinho";
	private EditText edtxtNomeParticipante;
	
	private Button btnOK;
	private OnClickListener okListener = new OnClickListener() {
		@Override
		public void onClick(View v) {
			nomeParticipante = edtxtNomeParticipante.getText().toString();
			if (nomeParticipante != null) {
				Intent i = new Intent(CreateParticipantActivity.this, AwaitGroupsActivity.class);
				i.putExtra("nomeParticipante", nomeParticipante);
				startActivity(i);
			}
		}
	};

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_create_participant);
		
		edtxtNomeParticipante = (EditText) findViewById(R.id.edtxtNomeParticipante);
		edtxtNomeParticipante.setText(nomeParticipante);
		
		btnOK = (Button) findViewById(R.id.btnCreateParticipant);
		btnOK.setOnClickListener(okListener);
	}

}
